﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FastReport;

namespace SmallERP.PrintManage
{
    public partial class FrmShowPaperCode : Form
    {
        public List<int> paperIdList { get; set; }
        Report rp = new Report();
        public FrmShowPaperCode()
        {
            InitializeComponent();
       
            rp.Load(Application.StartupPath + "\\Reports\\相纸条码.frx");
            rp.PrintSettings.ShowDialog = true;
        }

        private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
        {
            if (e.Info.IsRowIndicator)
            {
                if (e.RowHandle > -1)
                {
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
                }
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            foreach (var pId in paperIdList)
            {
                rp.SetParameterValue("pId", "*" + pId + "*");
                rp.Print();
            }
        }

        private void FrmShowPaperCode_Load(object sender, EventArgs e)
        {
            if (paperIdList != null && paperIdList.Count > 0)
            {
                gridControl1.DataSource = paperIdList;
            }
        }
    }
}
